# 设置要求的CMake最低版本
cmake_minimum_required(VERSION 3.0)

if (WIN32)
add_definitions(-DPANDA_WIN32)
elseif (IOS)
add_definitions(-DPANDA_APPLE)
elseif (APPLE)
add_definitions(-DPANDA_APPLE)
elseif (LINUX)
add_definitions(-DPANDA_LINUX)
endif()
# 设置项目名称
project(PandaTransportProtocol)

set(CMAKE_CXX_STANDARD 17)

add_definitions(-DNOMINMAX)
# 添加源文件
set(SOURCES_FILE
    transport/utils/histogram.cc
    transport/endpoint.cc
    transport/relaypoint.cc
)

# 添加头文件路径
include_directories(3rd_lib)
include_directories(api)
include_directories(protocol)
include_directories(transport)

add_subdirectory(3rd_lib/panda-framework)
add_subdirectory(test)

# 生成静态库

add_library(${PROJECT_NAME}_a STATIC ${SOURCES_FILE})

add_library(${PROJECT_NAME} SHARED ${SOURCES_FILE})

target_link_libraries(${PROJECT_NAME}
    panda_framework)
target_link_libraries(${PROJECT_NAME}_a
    panda_framework_a)

# 指定生成的静态库的输出路径
set_target_properties(${PROJECT_NAME} PROPERTIES
    ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
)
